package com.oim.core.config;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

import com.oim.core.common.data.FaceData;
import com.oim.core.common.util.FileNameUtil;

/**
 * @author: XiaHui
 * @date: 2017年8月22日 上午9:51:46
 */
public class FaceConfig {
	
	public List<FaceData> createFaceList() {
		List<FaceData> list = new ArrayList<FaceData>();

		String categoryId = "classical";
		String normal = "";
		String selected = "";
		for (int i = 0; i < 214; i++) {
			normal = "Resources/Images/Face/png/" + i + ".png ";
			selected = "Resources/Images/Face/" + i + ".gif ";

			FaceData fd = new FaceData();
			fd.setCategoryId(categoryId);
			fd.setHeight(40);
			fd.setWidth(40);
			fd.setKey(i + "");
			fd.setNormalPath(normal);
			fd.setHoverPath(selected);

			list.add(fd);
		}

		for (int i = 1000; i < 1003; i++) {
			normal = "Resources/Images/Face/OperationPath/" + i + ".png ";
			selected = "Resources/Images/Face/OperationPath/" + i + ".gif ";
			FaceData fd = new FaceData();
			fd.setCategoryId(categoryId);
			fd.setHeight(40);
			fd.setWidth(40);
			fd.setKey(i + "");
			fd.setNormalPath(normal);
			fd.setHoverPath(selected);

			list.add(fd);
		}

		normal = "Resources/Images/Face/OperationPath/" + 1014 + ".png ";
		selected = "Resources/Images/Face/OperationPath/" + 1014 + ".gif ";
		FaceData fd = new FaceData();
		fd.setCategoryId(categoryId);
		fd.setHeight(40);
		fd.setWidth(40);
		fd.setKey(1014 + "");
		fd.setNormalPath(normal);
		fd.setHoverPath(selected);

		list.add(fd);

		normal = "Resources/Images/Face/OperationPath/" + 1017 + ".png ";
		selected = "Resources/Images/Face/OperationPath/" + 1017 + ".gif ";
		fd = new FaceData();
		fd.setCategoryId(categoryId);
		fd.setHeight(40);
		fd.setWidth(40);
		fd.setKey(1017 + "");
		fd.setNormalPath(normal);
		fd.setHoverPath(selected);

		list.add(fd);

		normal = "Resources/Images/Face/OperationPath/" + 1022 + ".png ";
		selected = "Resources/Images/Face/OperationPath/" + 1022 + ".gif ";
		fd = new FaceData();
		fd.setCategoryId(categoryId);
		fd.setHeight(40);
		fd.setWidth(40);
		fd.setKey(1022 + "");
		fd.setNormalPath(normal);
		fd.setHoverPath(selected);

		list.add(fd);

		normal = "Resources/Images/Face/OperationPath/" + 1024 + ".png ";
		selected = "Resources/Images/Face/OperationPath/" + 1024 + ".gif ";
		fd = new FaceData();
		fd.setCategoryId(categoryId);
		fd.setHeight(40);
		fd.setWidth(40);
		fd.setKey(1024 + "");
		fd.setNormalPath(normal);
		fd.setHoverPath(selected);

		list.add(fd);

		for (int i = 1027; i < 1031; i++) {
			normal = "Resources/Images/Face/OperationPath/" + i + ".png ";
			selected = "Resources/Images/Face/OperationPath/" + i + ".gif ";
			fd = new FaceData();
			fd.setCategoryId(categoryId);
			fd.setHeight(40);
			fd.setWidth(40);
			fd.setKey(i + "");
			fd.setNormalPath(normal);
			fd.setHoverPath(selected);

			list.add(fd);
		}

		normal = "Resources/Images/Face/OperationPath/" + 1034 + ".png ";
		selected = "Resources/Images/Face/OperationPath/" + 1034 + ".gif ";
		fd = new FaceData();
		fd.setCategoryId(categoryId);
		fd.setHeight(40);
		fd.setWidth(40);
		fd.setKey(1034 + "");
		fd.setNormalPath(normal);
		fd.setHoverPath(selected);

		list.add(fd);

		normal = "Resources/Images/Face/OperationPath/" + 1040 + ".png ";
		selected = "Resources/Images/Face/OperationPath/" + 1040 + ".gif ";
		fd = new FaceData();
		fd.setCategoryId(categoryId);
		fd.setHeight(40);
		fd.setWidth(40);
		fd.setKey(1040 + "");
		fd.setNormalPath(normal);
		fd.setHoverPath(selected);

		list.add(fd);

		normal = "Resources/Images/Face/OperationPath/" + 1042 + ".png ";
		selected = "Resources/Images/Face/OperationPath/" + 1042 + ".gif ";
		fd = new FaceData();
		fd.setCategoryId(categoryId);
		fd.setHeight(40);
		fd.setWidth(40);
		fd.setKey(1042 + "");
		fd.setNormalPath(normal);
		fd.setHoverPath(selected);

		list.add(fd);

		for (int i = 1070; i < 1075; i++) {
			normal = "Resources/Images/Face/OperationPath/" + i + ".png ";
			selected = "Resources/Images/Face/OperationPath/" + i + ".gif ";
			fd = new FaceData();
			fd.setCategoryId(categoryId);
			fd.setHeight(40);
			fd.setWidth(40);
			fd.setKey(i + "");
			fd.setNormalPath(normal);
			fd.setHoverPath(selected);

			list.add(fd);
		}
		return list;
	}
	public List<FaceData> emotionList() {
		List<FaceData> list = new ArrayList<FaceData>();
		File directory=new File("Resources/Images/Face/emotion");
		if(directory.exists()&&directory.isDirectory()) {
			File[] files=directory.listFiles();
			if(null!=files) {
				for(File file:files) {
					String name=file.getName();
					String value=FileNameUtil.getName(name);
					String normal = file.getAbsolutePath();
					String selected = normal;
					
					FaceData fd = new FaceData();
					fd.setCategoryId("emotion");
					//fd.setHeight(40);
					//fd.setWidth(40);
					
					fd.setKey(value);
					fd.setNormalPath(normal);
					fd.setHoverPath(selected);
					
					list.add(fd);
				}
			}
		}
		return list;
	} 
}
